"""
__author__ = 'berlinyoung'
@File   :contact_addmember_page.py
@Date   :2022/5/18 20:48
-*- coding: utf-8 -*-
"""
import time

from appium.webdriver.common.mobileby import MobileBy

from weixin_mobile.step1_po.page.base import Base
from weixin_mobile.step1_po.page.contact_addmember_edit_page import ManualAddMember


class AddMemberPage(Base):

    #手动输入添加元素
    ele_manual_add = (MobileBy.ID,"d6d")
    # #真机端的元素值
    # ele_manual_add = (MobileBy.ID, "ds6")

    def manual_addmember(self):
        self.find_click(*self.ele_manual_add)
        return ManualAddMember(self.driver)

    def get_tip(self):
        print(self.driver.page_source)
        # return True
        if "添加成功" in self.driver.page_source:
            result = self.find(MobileBy.XPATH,"//*[@class='android.widget.Toast']").get_attribute("text")
            return result

        else:
            result = self.find(MobileBy.ID,"c07").get_attribute("text")
            return result